Skip to content

fix: reload examples page only when the session has expired - #6702

Merged
peholmst merged 1 commit into
mainfrom
fix/session-verification-reload-loop
Dec 2, 2026
Merged

peholmst merged 1 commit into
mainfrom
fix/session-verification-reload-loop

Conversation

@totally-not-ai

@totally-not-ai totally-not-ai Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Summary

On pages with Flow examples, the docs site could reload itself over and over: after scrolling (which loads more examples), the page reloaded, then again five minutes later, and so on. This PR stops those reloads.

What changed

The session check in session-verification.ts sends a heartbeat for UI id 0 and used to reload the page on any non-OK response. Flow answers a heartbeat with:

  • 403 when the session has expired (the case the check was written for);
  • 404 when the session is alive but has no UI with that id.

The 404 case is normal. UI ids grow within a session, so once the session's first page is closed (its UI is closed on unload), every later page gets a higher id and the heartbeat for UI 0 returns 404. A reload can't fix that, so the page reloaded every time the 5-minute guard ran out and another example loaded.

The check now reloads only on 403. Other failures (404, 5xx while the server restarts) no longer reload the page, since a reload wouldn't help there either. The 5-minute guard is unchanged.

Test summary

  • Checked against Flow's HeartbeatHandler: 404 for an unknown UI id, 403 for an expired session. The live site returns 403 for a heartbeat without a session.
  • ESLint/Prettier pass. This browser-only script has no automated tests.

Working on behalf of Artur

The session check sends a heartbeat for UI id 0 and reloaded the page on
any non-OK response. Flow answers 404 when the session is alive but has
no UI with that id, which is the normal state once the first page of a
session has been closed: later pages get higher UI ids. Reloading never
changes that, so the page reloaded again every five minutes as more
examples were loaded. Reload only on 403, which is what Flow returns
for an expired session.
@github-actions

Copy link
Copy Markdown
Contributor

Preview Deployment

This PR has been deployed for preview.

URL: https://docs-preview-pr-6702.fly.dev

No documentation page changes detected.

Other changed files

  • frontend/demo/session-verification.ts (modified)

Built from 3b13396

@Artur-
Artur- marked this pull request as ready for review November 22, 2026 16:43

@vaadin-review-bot vaadin-review-bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Nothing to flag — the changes look good.

@peholmst
peholmst merged commit 27bcb0e into main Dec 2, 2026
17 checks passed
@peholmst
peholmst deleted the fix/session-verification-reload-loop branch December 2, 2026 11:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants